#include <baker/Intersect.h>
#include <unittest++/UnitTest++.h>

using namespace baker;

SUITE( TestIntersect )
{
    TEST( Ray3_Triangle )
    {
        Intersect<Ray3, Triangle> i;

        Ray3 ray( Vec3( 0, 0, 0 )
                , Vec3( 0, 1, 0 )
                );

        Triangle tri( Vec3( 0, 2, 1 )
                    , Vec3( 1, 2, 0 )
                    , Vec3(-1, 2, 0 )
                    );

        i.test( ray, tri );

        CHECK( i.getHit() == true );

        CHECK( ray.getPoint( i.getRayHitDist() ) == Vec3( 0, 2, 0 ) );
    }
}
